#include<iostream>
using namespace std;
int main()
{
  cout<<"2022-1-11 begin your dream"<<endl;
  int num;
  cout<<"请输入数组的元素个数"<<endl;
  cin>>num;
  int *a = new int[num];
  cout<<"请输入元素:"<<endl;
  for(int i=0;i<num;i++){
    cin>>a[i];
  }
  int f = 0,e = num-1;

  int target;
  cout<<"请输入查找元素:"<<endl;
  cin>>target;

  while(f!=e){
    if (a[f]+a[e]==target){
      cout<<"index:"<<f<<" "<<e<<endl;
      return 0;
    }
    if (a[f]+a[e]>target) e--;
    else f++;
  }
  
  cout<<"找不到答案\n";
	return 0;
}






